<?php

use App\Photo;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePhotosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create(Photo::TABLE, function (Blueprint $table) {
            $table->increments('id');
            $table->string('image')->comment('图片地址');
            $table->unsignedInteger('type_id')->default(0)->comment('图片类型');
            $table->unsignedBigInteger('click')->default(0)->comment('点击次数');
            $table->integer('score')->default(0)->comment('评分');
            $table->integer('weight')->default(0)->comment('排序权重');
            $table->boolean('is_slide')->default(false)->comment('是否首页幻灯');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists(Photo::TABLE);
    }
}
